
<%
   String is_admin = (String)session.getAttribute( "AdminCheck" );
   String id = session.getId();
   // Condition statement to determine if the Session Variable has been
   // properly set.
   
   //如果是管理员才可以上传
   if ( (! (is_admin == null)) && ( is_admin.equals("true")) )
   {
%>
<%@page contentType="text/html;charset=utf-8" %>
<%@page import = "java.util.*, org.adl.samplerte.util.*,
                  org.adl.samplerte.server.*" %>
                  
<%
   /***************************************************************************
   **
   ** Filename:  importCourse.jsp
   **
   ** File Description:  This file allows the user to enter a name for a new
   **                    course, and select the zip
   **                    file that contains the manifest and course content.
   **
   **
   ** Author: ADL Technical Team
   **
   ** Contract Number:
   ** Company Name: CTC
   **
   ** Module/Package Name:
   ** Module/Package Description:
   **
   ** Design Issues:
   **
   ** Implementation Issues:
   ** Known Problems:
   ** Side Effects:
   **
   ** References: ADL SCORM
   **
   /***************************************************************************
     
ADL SCORM 2004 4th Edition Sample Run-Time Environment 

The ADL SCORM 2004 4th Ed. Sample Run-Time Environment is licensed under
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States.

The Advanced Distributed Learning Initiative allows you to:
  *  Share - to copy, distribute and transmit the work.
  *  Remix - to adapt the work. 

Under the following conditions:
  *  Attribution. You must attribute the work in the manner specified by the author or
     licensor (but not in any way that suggests that they endorse you or your use
     of the work).
  *  Noncommercial. You may not use this work for commercial purposes. 
  *  Share Alike. If you alter, transform, or build upon this work, you may distribute
     the resulting work only under the same or similar license to this one. 

For any reuse or distribution, you must make clear to others the license terms of this work. 

Any of the above conditions can be waived if you get permission from the ADL Initiative. 
Nothing in this license impairs or restricts the author's moral rights.

   ***************************************************************************/
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
   <title>SCORM 2004 4th Edition Sample Run-Time Environment Version 1.1 - 
    Import Course</title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

   <link href="../includes/sampleRTE_style.css" rel="stylesheet" type="text/css" />

   <script type="text/javascript">   
//<!-- [CDATA[

   /****************************************************************************
   **
   ** Function:  checkValues()
   ** Input:   none
   ** Output:  boolean
   **
   ** Description:  This function ensures that there are values in each text
   **               box before submitting
   **
   ***************************************************************************/
   function checkValues()
   {
      if (document.getElementById("coursezipfile").value == "" )
      {
         alert( "You must enter a value for all items" );
         return false;
      }
      else
      {
         
         file = document.getElementById("coursezipfile").value;
         index = file.length;
         start = index - 4;
         //获得文件后缀
         extension = file.substring(start, index);
         extension = extension.toLowerCase();
         //判断文件后缀是否为zip
         if (extension != ".zip")
         {
            alert( "The file you have selected is not a Zip file, please " +
                   "select a Zip file" );
            return false;
         }
      }
      
      //将上传的文件名传递给隐藏的“theZipFile”元素值
      document.getElementById("theZipFile").value = document.getElementById("coursezipfile").value;
      return true;
   }

   /****************************************************************************
   **
   ** Function:  newWindow()
   ** Input:   pageName
   ** Output:  none
   **
   ** Description:  This function opens the help window
   **
   ***************************************************************************/
   function newWindow( pageName )
   {
      window.open(pageName, 'Help',
      "toolbar=no,location=no,directories=no,status=no,menubar=no," +
      "scrollbars=yes,resizable=yes,width=500,height=500");
   }
   /***************************************************************************
   **
   ** Function:  disableElements()
   ** Input:   none
   ** Output:  boolean
   **
   ** Description: This makes the call to checkValues, if it returns true then this disables 
   ** the submit button and the link to return to the main menu. It also removes the underline 
   ** from the link.
   **
   ***************************************************************************/
   function disableElements()
   {
      if (checkValues())
      {
         var subButton = document.getElementById('submitButton');
         
         subButton.disabled = true;
         //document.getElementById('homelink').disabled = true;
         document.getElementById('homelink').style.visibility = "hidden";
         return true;
      }
      else
      {
         return false;
      }   
   }
   //]]-->
   </script>
</head>

<body bgcolor="#FFFFFF">

<jsp:include page="../runtime/LMSNavigation.jsp" flush="true">
    <jsp:param value="/Adl1.1/help/importHelp.htm" name="helpURL"/>
</jsp:include>


<form method="post" action="/Adl1.1/LMSCourseAdmin?type=<%= ServletRequestTypes.IMPORT_COURSE %>&sessID=<%=id%>" name="courseInfo"
      onsubmit="return disableElements();" enctype="multipart/form-data">

   <p class="font_header">
   <b>
      导入课件
   </b>
   </p>


   <table width="450" border="0" align="left">
      <tr>
         <td colspan="2">
            <hr />
         </td>
      </tr>
      <tr>
         <td bgcolor="#5E60BD" colspan="2" class="white_text">
            <b>
               &nbsp;请提供课件信息:
            </b>
         </td>
      </tr>
      <tr>
         <td>&nbsp;</td>
      </tr>
      <tr>
         <td>
            输入你想导入的课件压缩文件的路径或选择浏览：
         </td>
      </tr>
      <tr>
         <td>
            <label for="coursezipfile">课件压缩文件:&nbsp;</label>
            <input id="coursezipfile" name="coursezipfile" type="file" />
         </td>
      </tr>
      <tr>
         <td>&nbsp;</td>
      </tr>
      <tr>
         <td>
          选择使用改进前验证系统还是改进后的验证系统
         </td>
      </tr>
      <tr><td>&nbsp;</td></tr>
      <tr>
         <td>
            <input id="validateYES" name="validate" type="radio" value="1" checked="checked"  style="display:none"/> 
            <!-- <label for="validateYES">Full (Requires Internet Connection)</label> -->
         </td>
      </tr>
      <tr>
        <td>
            <input id="validateNO" name="validate" type="radio" value="0" style="display:none"/> 
            <!-- <label for="validateNO">Partial (No Internet Connection Required)</label> -->
        </td>
      </tr>
      <tr><td>&nbsp;</td></tr>
      <tr>
         <td>
            <input id="improveYES" name="improve" type="radio" value="1" checked="checked" /> 
            <label for="improveYES">Improved(改进后的验证系统)</label>
         </td>
      </tr>
      <tr>
        <td>
            <input id="improveNO" name="improve" type="radio" value="0" /> 
            <label for="improveNO">Original (改进前的验证系统)</label>
        </td>
      </tr>
      
      
      
      
      <tr>
         <td colspan="2">
            <hr />
         </td>
      </tr>
      <tr>
         <td>&nbsp;</td>
      </tr>
      <tr>
         <td width="100%" colspan="2" align="center">
            <input id="submitButton" type="submit" name="Submit" value="提交" />
         </td>
      </tr>
   </table>

   <input type="hidden" name="theManifest" />
   <input type="hidden" id="theZipFile" value="" />
</form>

</body>
</html>


<%
   }
   else
   {
      // Redirect the user to the RTE Home page.
      response.sendRedirect( "/Adl1.1/LMSCourseAdmin?type=" + ServletRequestTypes.GO_HOME + "&userID=");
   }
%>
